package zuoye;
import java.util.ArrayList;
import java.util.List;

public class ClassManager {
    //创建班级列表
    private List<Class> classes = new ArrayList<>();

    // 新增班级
    public void addClass(Class clazz) {
        classes.add(clazz);
    }

    // 维护班级
    public void updateClass(Class clazz) {
        for (int i = 0; i < classes.size(); i++) {
            if (classes.get(i).getId().equals(clazz.getId())) {
                classes.set(i, clazz);
                break;
            }
        }
    }

    // 班级列表
    public List<Class> getClassList() {
        return classes;
    }
}

class Class {
    private String id;
    private String name;

    public Class(String id, String name) {
        this.id = id;
        this.name = name;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
